import request from '/@/utils/request';

/**
 * 数据库操作接口
 */
export function useDbApi() {
	return {
		getDbList: (params?: object) => {
			return request<any, AjaxResult>({
				url: '/database/List',
				method: 'get',
				params,
			});
		},
		getApplicationNamespaces: (params?: object) => {
			return request<any, AjaxResult>({
				url: '/codegen/ApplicationNamespaces',
				method: 'get',
				params,
			});
		},
		getTableList: (configId:string) => {
			return request<any, AjaxResult>({
				url: '/database/tableList/'+configId,
				method: 'get',
				//params,
			});
		},
		getColumnList: (tableName:string ,configId:string) => {
			return request<any, AjaxResult>({
				url: '/database/columnList/'+tableName+'/'+configId,
				method: 'get',
				//params,
			});
		},
		deleteTable: (data={}) => {
			return request<any, AjaxResult>({
				url: '/database/DeleteTable',
				method: 'post',
				data,
			});
		},
		deleteColumn: (data={}) => {
			return request<any, AjaxResult>({
				url: '/database/DeleteColumn',
				method: 'post',
				data,
			});
		},
		updateTable: (data={}) => {
			return request<any, AjaxResult>({
				url: '/database/UpdateTable',
				method: 'post',
				data,
			});
		},
		updateColumn: (data={}) => {
			return request<any, AjaxResult>({
				url: '/database/UpdateColumn',
				method: 'post',
				data,
			});
		},
		addTable: (data={}) => {
			return request<any, AjaxResult>({
				url: '/database/AddTable',
				method: 'post',
				data,
			});
		},
		addColumn: (data={}) => {
			return request<any, AjaxResult>({
				url: '/database/addColumn',
				method: 'post',
				data,
			});
		},
		createEntity: (data={}) => {
			return request<any, AjaxResult>({
				url: '/database/createEntity',
				method: 'post',
				data,
			});
		},
		createSeedData: (data={}) => {
			return request<any, AjaxResult>({
				url: '/database/createSeedData',
				method: 'post',
				data,
			});
		},

		// posPageList: (data={}) => {
		// 	return request<any, AjaxResult>({
		// 		url: '/pos/PageList',
		// 		method: 'post',
		// 		data,
		// 	});
		// },
		// addPos: (data={}) => {
		// 	return request<any, AjaxResult>({
		// 		url: '/pos/Add',
		// 		method: 'post',
		// 		data,
		// 	});
		// },
		// editPos: (data={}) => {
		// 	return request<any, AjaxResult>({
		// 		url: '/pos/Update',
		// 		method: 'post',
		// 		data,
		// 	});
		// },
		// deletePos: (data={}) => {
		// 	return request<any, AjaxResult>({
		// 		url: '/pos/Delete',
		// 		method: 'post',
		// 		data,
		// 	});
		// },
	};
}
